<template>
  <!-- 商品列表  主页面 -->
  <div class="app-container ">
    <div class="zdy-main customTab customTabNew" v-loading="loading">

      <!-- <el-tabs type="border-card" v-model="actived"  v-loading="loading"> -->
      <el-form :model="queryParams" ref="queryForm" :inline="true" class="zdy-form search-form-new" label-width="68px" @keyup.enter.native="search">
        <el-form-item label="店铺" prop="tenantId" v-hasPermi="['searchTenantID']">
          <el-select v-model="queryParams.tenantId" placeholder="请选择店铺" clearable filterable>
            <el-option v-for="dict in tenantList" :key="dict.tenantId" :label="dict.tenantName" :value="dict.tenantId" />
          </el-select>
        </el-form-item>
        <el-form-item label="游戏" prop="gameId">
          <el-select filterable v-model="queryParams.gameId" placeholder="请选择游戏" clearable @change="selectGameType">
            <el-option v-for="dict in gameList" :key="dict.id" :label="dict.name" :value="dict.id" />
          </el-select>
        </el-form-item>
        <el-form-item label="系统" prop="systemId" v-if="GameSelectedType === 0">
          <el-select v-model="queryParams.systemId" placeholder="请选择" clearable  filterable>
            <el-option v-for="dict in sysList" :key="dict.id" :label="dict.fieldName" :value="dict.id" />
          </el-select>
        </el-form-item>
        <el-form-item label="运营商" prop="carrierId" v-if="GameSelectedType === 0">
          <el-select v-model="queryParams.carrierId" placeholder="请选择" clearable @change="getAreaList" filterable>
            <el-option v-for="dict in carrierList" :key="dict.id" :label="dict.fieldName" :value="dict.id" />
          </el-select>
        </el-form-item>
        <el-form-item label="大区" prop="groupId">
          <el-select v-model="queryParams.groupId" placeholder="请选择" clearable @change="getServiceList" filterable>
            <el-option v-for="dict in areaList" :key="dict.id" :label="dict.fieldName" :value="dict.id" />
          </el-select>
        </el-form-item>
        <el-form-item label="服务器" prop="serverId">
          <el-select v-model="queryParams.serverId" placeholder="请选择" clearable  filterable>
            <el-option v-for="dict in serverList" :key="dict.id" :label="dict.fieldName" :value="dict.id" />
          </el-select>
        </el-form-item>
        <el-form-item label="价格" prop="price" class="mm-b-8">
          <div class="two-input-content">
            <el-input placeholder="最低价" v-model="queryParams.priceStart" class="two-input-item" style="width: 100px !important"></el-input>
            <span>-</span>
            <el-input placeholder="最高价" v-model="queryParams.priceEnd" class="two-input-item" style="width: 100px !important"></el-input>
          </div>
        </el-form-item>
        <el-form-item v-hasPermi="['goods:list:searchSupply']" label="创建人" prop="createIds">
          <virtual-select v-model="queryParams.createIds" :list="allUsers" label="nickName" value="userId" :placeholder="'输入关键字用于搜索用户'" :keeps-params="20" :is-concat="false" :concat-symbol="' || '" :is-multiple="true" :disabled="false" :allow-create="false" />
        </el-form-item>

        <!-- <el-form-item label="商品描述" prop="des">
            <el-input v-model="queryParams.des" placeholder="请输入商品描述" clearable />
          </el-form-item> -->
        <el-form-item label="商品编号" prop="id">
          <el-input v-model="queryParams.id" placeholder="请输入商品编号" clearable />
        </el-form-item>
        <el-form-item label="游戏账号" prop="accountNumber">
          <el-input v-model="queryParams.accountNumber" placeholder="请输入游戏账号" clearable />
        </el-form-item>
        <el-form-item label="自编号" prop="thirdId">
          <el-input v-model="queryParams.thirdId" placeholder="请输入自编号" clearable />
        </el-form-item>
        <el-form-item label="关键字" prop="keyWord">
          <el-input v-model="queryParams.keyWord" placeholder="多个关键字用空格隔开" clearable />
        </el-form-item>
        <el-form-item label="三方ID" prop="outid" v-hasPermi="['goods:list:searchOtherID']">
          <el-input v-model="queryParams.outid" placeholder="请输入三方ID" clearable />
        </el-form-item>
        <el-form-item label="库存天数" prop="unsoldDays">
          <el-input-number :controls="false" v-model="queryParams.unsoldDays" placeholder="请输入库存天数" clearable />
        </el-form-item>
        <!-- <el-form-item label="置顶" prop="isTop">
            <el-select v-model="queryParams.isTop" placeholder="请选择" clearable @change="search" filterable>
              <el-option label="置顶" :value="1" />
              <el-option label="不置顶" :value="2" />
            </el-select>
          </el-form-item> -->
        <el-form-item label="是否代售" prop="ifself">
          <el-select v-model="queryParams.ifself" placeholder="请选择" clearable  filterable>
            <el-option label="自营" :value="1" />
            <el-option label="代售" :value="2" />
          </el-select>
        </el-form-item>
        <el-form-item label="部门" prop="deptIdList" v-hasPermi="['goods:list:deptSearch']">
          <el-select class="bumen" collapse-tags v-model="queryParams.deptIdList" placeholder="请选择" multiple clearable>
            <el-option v-for="dict in allDepts" :key="dict.deptId" :label="dict.deptName" :value="dict.deptId" />
          </el-select>
        </el-form-item>
        <!-- unsoldDays -->
        <el-form-item class="btns">
          <el-button type="primary" icon="el-icon-search" @click="search">搜索</el-button>
          <el-button type="warning" icon="el-icon-refresh" @click="resetQuery">重置</el-button>
          <el-button v-hasPermi="['goods:list:release']" icon="el-icon-plus" type="success" @click="addACount">发布</el-button>
          <el-button type="primary" plain icon="el-icon-search" @click="openMoreSearch">更多搜索</el-button>
          <el-button type="primary" plain v-if="
                checkPermi(['goods:list:checkbatch']) &&pageType == 'check'" icon="el-icon-plus" @click="checkAccountFn(false)">批量审核</el-button>
          <el-button v-hasPermi="['goods:list:copyBatch']" type="primary" plain icon="el-icon-document-copy" @click="copyBatch">批量复制</el-button>
          <el-button v-if="
                checkPermi(['goods:list:offShelfBatch']) &&
                pageType != 'check' &&
                pageType != 'pool'
              " type="danger" plain icon="el-icon-delete" @click="piliangXiajia">批量下架</el-button>
          <el-button type="danger" plain icon="el-icon-delete" v-hasPermi="['goods:list:offShelfAll']" @click="deleteAll">全部下架</el-button>
          <el-dropdown @command="pushBatch" v-hasPermi="['goods:list:pushAll']">
            <el-button type="primary">
              一键推送
              <i class="el-icon-arrow-down el-icon--right"></i>
            </el-button>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item v-for="item in pushApiList" :command="item.id" :key="item.id">{{ item.name }}</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
          <el-button style="margin-left: 10px" type="warning" plain icon="el-icon-upload" v-hasPermi="['goods:list:importGoods']" @click="piliangdaoru">通用导入</el-button>
          <el-button style="margin-left: 10px" type="success" plain icon="el-icon-upload" v-hasPermi="['goods:list:importGoods']" @click="dakaipiliangdaoru">游戏专属导入</el-button>
          <el-button v-if="userInfo&&(userInfo.tenantId==12||userInfo.tenantId==278)" style="margin-left: 10px" type="warning" plain @click="openQRCode">我的选号网</el-button>
          <el-button v-hasPermi="['goods:list:lengqueshezhi']" type="primary" plain icon="el-icon-setting" @click="openLengQue">商品冷却设置</el-button>
          <el-button style="margin-left: 10px" type="warning" icon="el-icon-setting" plain @click="headerSet">表头设置</el-button>
        </el-form-item>
      </el-form>
      <!-- <el-tab-pane :label="tab.name" :name="tab.value" v-for="tab in statusList" :key="tab.value"> -->
      <div class="tabs flex alc">
        <el-radio-group v-model="actived" @change="tabChange">
          <el-radio-button :label="tab.value" v-for="tab in statusList" :key="tab.value">{{ tab.name }}</el-radio-button>
        </el-radio-group>
        <div class="tongji_box" v-if="totalNumber">
          <span>
            总成本:
            <span class="price">{{ formatter(totalNumber.costPriceSum||0) }}</span>元
          </span>
          <span v-if="totalNumber.priceSum">
            总商品价:
            <span class="price">{{ formatter(totalNumber.priceSum||0) }}</span>元
          </span>
          <!-- <span v-if="totalNumber.newPirceSum">
            总挂售价:
            <span class="price">{{ formatter(totalNumber.newPirceSum||0) }}</span>元
          </span> -->
        </div>
      </div>
      <div class="table_box table_box_new" v-if="columnList&&columnList.length">
        <el-table ref="tableRef" stripe border :data="tableData.records" height="calc(100vh - 400px)" @sort-change="sortFun" @selection-change="handleSelection">
          <el-table-column type="selection" width="55"> </el-table-column>
          <!-- 动态显示列 -->
          <template v-for="column in columnList">
            <el-table-column :key="column.key" v-if="column.isShow" :label="column.label" :width="column.width" :min-width="column.minWidth" :prop="column.key" :sortable="column.sortable">
              <template slot-scope="scope">
                <template v-if="column.key=='id'">
                  <span v-show="scope.row.ifself" class="sign" :class="{ ping: scope.row.ifself == 2 }">{{ scope.row.ifself == 1 ? "自" : "代" }}</span>
                  <span class="link" @click="viewGoods(scope.row)">{{ scope.row.id }}</span>
                </template>
                <template v-else-if="column.key=='accountType'">
                  <el-tag type="success" v-if="scope.row.accountType==1">人工</el-tag>
                  <el-tag type="danger" v-if="scope.row.accountType==2">API</el-tag>
                </template>
                <template v-else-if="column.key=='saleState'">
                  <el-tag :type="
                      commonMaps.goodsStatusMap[scope.row.saleState]
                        ? commonMaps.goodsStatusMap[scope.row.saleState].type
                        : ''
                    ">{{
                      commonMaps.goodsStatusMap[scope.row.saleState]
                        ? commonMaps.goodsStatusMap[scope.row.saleState].name
                        : ""
                    }}</el-tag>

                  <div style="font-size: 12px;" v-if="scope.row.saleState === 0">
                    <span style="color: blue;cursor: pointer;" v-if="scope.row.autoImgState == 2" @click="openYanzhengma(scope.row.autoImgRecordId,scope.row.accountNumber,scope.row.gameName)">请输入验证码</span>
                    <span style="color: #e6a23c" v-if="scope.row.autoImgState == 3">自动截图中</span>
                    <span style="color: #67c23a" v-if="scope.row.autoImgState == 4">自动截图成功</span>
                    <span style="color: #e02020" v-if="scope.row.autoImgState == 5">自动截图失败</span>
                  </div>
                </template>
                <template v-else-if="column.key=='systemName'">
                  <span>{{
                    scope.row.systemName ? scope.row.systemName + "/" : ""
                  }}</span>
                  <span>{{
                    scope.row.carrierName ? scope.row.carrierName + "/" : ""
                  }}</span>
                  <span>{{
                    scope.row.groupName ? scope.row.groupName + "/" : ""
                  }}</span>
                  <span>{{ scope.row.serverName }}</span>
                </template>
                <template v-else-if="column.key=='backClueOrderId'">
                  <span class="link" v-if="scope.row.backClueOrderId&&checkPermi(['backOrder:viewOrder'])" @click="openBackOrderDetail(scope.row.backClueOrderId)">查看回收单</span>
                  <span class="link" v-else-if="scope.row.saleState==1&&checkPermi(['backOrder:add'])" @click="openBackOrderAdd(scope.row)">补录回收单</span>
                </template>
                <template v-else-if="column.key=='title'||column.key=='des'||column.key=='importantRemark'">
                  <el-tooltip class="item" effect="dark" :content="scope.row[column.key]" placement="top-start">
                    <div class="zdy-des">{{ scope.row[column.key] }}</div>
                  </el-tooltip>
                </template>
                <template v-else-if="column.key=='titleImg'">
                  <imgBox width="78px" height="50" :img="scope.row.titleImg"></imgBox>
                </template>
                <template v-else-if="column.key=='dakuanImg'||column.key=='otherImg'||column.key=='walletImg'||column.key=='secondImg'">
                  <imgBox width="50px" height="50" isWrap="nowrap" :img="scope.row[column.key]"></imgBox>
                </template>
                <template v-else-if="column.key=='ifself'">
                  <el-tag type="success" v-if="scope.row.ifself==1">自营</el-tag>
                  <el-tag type="danger" v-if="scope.row.ifself==2">代售</el-tag>
                </template>
                <template v-else-if="column.key=='securityPhone'">
                  <div>{{ scope.row.securityPhone }}</div>
                </template>
                <template v-else-if="column.key=='accountNumber'">
                  <div>{{ scope.row.accountNumber }}</div>
                  <el-tag type="warning" v-if="getEndTime(scope.row.maxCreateTime,scope.row.carrierType,scope.row.carrierName)">
                    {{ getEndTime(scope.row.maxCreateTime,scope.row.carrierType,scope.row.carrierName) }}
                  </el-tag>
                </template>
                <template v-else-if="column.key=='monitoringState'">
                  <div>
                    <span style="cursor: pointer; color: green" @click="openRecords(scope.row.id)" v-if="scope.row.monitoringState == 1">监控中</span>
                    <span style="cursor: pointer; color: blue" @click="openRecords(scope.row.id)" v-if="scope.row.monitoringState == 2">监控中</span>
                    <span v-else-if="scope.row.monitoringState == 3" style="color: grey">未加入</span>
                  </div>
                </template>
                <template v-else-if="column.key=='monitoringIssues'">
                  <div>
                    <span v-if="scope.row.monitoringIssues == 1" style="color: green">在绑</span>
                    <span v-if="scope.row.monitoringIssues == 2" style="color: red">不在绑</span>
                  </div>
                </template>
                <template v-else-if="column.key=='isTop'">
                  <div>
                    <el-switch @change="isTopChange($event, scope.row)" v-model="scope.row.isTop" :active-value="1" :inactive-value="2">
                    </el-switch>
                  </div>
                </template>
                <template v-else-if="column.key=='createName'">
                  <div>
                    <span class="link" @click="getOtherUserInfo(scope.row.createId)">{{ scope.row.createName }}</span>
                  </div>
                </template>
                <template v-else-if="column.key=='ziliao'">
                  <div style="color: #6c5dd3; cursor: pointer" type="text" @click="viewInfo(scope.row)">
                    查看资料
                  </div>
                </template>
                <template v-else>
                  {{ scope.row[column.key] }}
                </template>
              </template>
            </el-table-column>
          </template>

          <el-table-column label="操作" :width="200" fixed="right">
            <template slot-scope="scope">
              <el-button type="edit" v-if="checkPermi(['goods:list:edit'])&& (scope.row.saleState == 1|| scope.row.saleState == 4 || scope.row.saleState == 0 || scope.row.saleState == 98)" @click="handleUpdate(scope.row)">编辑</el-button>
              <el-button type="text" v-if=" (scope.row.saleState == 2|| scope.row.saleState == 3 || scope.row.saleState == 5|| scope.row.saleState == 6 )" @click="handleUpdate(scope.row)">查看</el-button>
              <el-button type="text" v-if="checkPermi(['goods:list:shangjia'])&&(scope.row.saleState == 4 || scope.row.saleState == 5)" @click="upSale(scope.row.id)">上架</el-button>
              <span class="btn" v-hasPermi="['goods:list:clone']">
                <el-button type="text" v-if="scope.row.saleState == 1|| scope.row.saleState == 4 " @click="priceedit(scope.row)">改价</el-button>
              </span>
              <span class="btn" v-if="checkPermi(['goods:list:check'])&&(scope.row.saleState == 0)">
                <el-button type="add" @click="checkAccountFn(scope.row)">审核</el-button>
              </span>
              <span class="btn" v-hasPermi="['goods:list:xiajia']">
                <el-button type="del" style="color: red" v-if="scope.row.saleState == 1 && pageType != 'pool'" @click="downSale(scope.row.id)">下架</el-button>
              </span>
              <span class="btn" v-hasPermi="['goods:list:copy']">
                <el-button ref="copyBtn1" type="text" v-if="scope.row.saleState == 1" v-clipboard:copy="copyVlaue" v-clipboard:error="onError" v-clipboard:success="onCopy" @click="keyCopy(scope.row)">复制</el-button>
              </span>
              <span class="btn" v-hasPermi="['goods:list:tihao']">
                <el-button type="add" v-if="scope.row.saleState == 1" @click="addOrder(scope.row)">提号</el-button>
              </span>
              <span class="btn" v-hasPermi="['goods:list:teshu']">
                <el-button type="edit" @click="openTeshu(scope.row)">特殊</el-button>
              </span>
              <!-- 更多操作 -->
              <el-dropdown trigger="click" @command="moreFn($event,scope.row)">
                <span class="el-dropdown-link">
                  更多操作<i class="el-icon-arrow-down el-icon--right"></i>
                </span>
                <el-dropdown-menu slot="dropdown">
                  <el-dropdown-item v-if="checkPermi(['goods:list:zhuanwenti'])&&(scope.row.saleState == 1 ||scope.row.saleState == 4 || scope.row.saleState == 3 || scope.row.saleState == 6)" command="3">到问题</el-dropdown-item>
                  <el-dropdown-item v-if="checkPermi(['goods:list:del'])&&(scope.row.saleState == 4 || scope.row.saleState == 5 ||scope.row.saleState == 6 ||scope.row.saleState === 0)" command="4">删除</el-dropdown-item>
                  <el-dropdown-item v-if="checkPermi(['goods:list:zhuanzhaohui'])&&(scope.row.saleState == 5 )" command="5">到损耗</el-dropdown-item>
                  <!-- <el-dropdown-item v-if="checkPermi(['goods:list:check'])&&(scope.row.saleState == 0)" command="6">审核</el-dropdown-item> -->
                  <!-- <el-dropdown-item v-if="checkPermi(['goods:list:clone'])&&(scope.row.saleState == 1)" command="7">克隆</el-dropdown-item> -->
                  <el-dropdown-item v-if="checkPermi(['goods:list:log'])&&(scope.row.saleState != 0)" command="8">日志</el-dropdown-item>
                  <el-dropdown-item v-if="checkPermi(['goods:list:log'])" command="9">三方对接</el-dropdown-item>
                  <el-dropdown-item v-if="checkPermi(['goods:list:watchaccount'])&&(scope.row.saleState == 1 || scope.row.saleState == 3) && scope.row.monitoringState == 3" command="10">加入监控</el-dropdown-item>
                  <el-dropdown-item v-if="checkPermi(['goods:list:addBlack'])&&(scope.row.saleState == 4 || scope.row.saleState == 5 || scope.row.saleState == 6) &&scope.row.isBlack == 1" command="11">加入黑名单</el-dropdown-item>
                  <el-dropdown-item v-if="checkPermi(['jingpaishichang:fabujingpai'])&&(scope.row.saleState == 1)" command="12">发布到竞拍</el-dropdown-item>
                  <el-dropdown-item v-if="scope.row.saleState == 1" command="13">刷新</el-dropdown-item>
                  <el-dropdown-item command="14">操作记录</el-dropdown-item>
                  <el-dropdown-item command="17">换绑记录</el-dropdown-item>
                  <el-dropdown-item command="15">其他图片</el-dropdown-item>
                  <el-dropdown-item command="16">复制其他图片</el-dropdown-item>
                </el-dropdown-menu>
              </el-dropdown>
            </template>
          </el-table-column>
        </el-table>
        <pagination v-show="tableData.total > 0" :total="tableData.total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
      </div>
      <!-- </el-tab-pane>
      </el-tabs> -->
    </div>
    <!-- <div class="pages-box">

      <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
        :current-page="queryParams.pageNum" :page-sizes="[10, 20, 30, 40, 50, 60]" :page-size="queryParams.pageSize"
        layout="total, sizes, prev, pager, next" :total="tableData.total"></el-pagination>
    </div> -->
    <!-- 一下是弹出框 -->
    <!-- <h5Dialog ref="h5Dialog"></h5Dialog> -->
    <addDialog ref="addDialog" @success="getList" @close="addClose"></addDialog>
    <onSelfDialog ref="onSelfDialog"></onSelfDialog>
    <deleteDialog ref="deleteDialog"></deleteDialog>
    <pushDialog ref="pushDialog"></pushDialog>
    <moreSearch ref="moreSearch" @sureSearch="sureSearch"></moreSearch>
    <showLogs ref="showLogs"></showLogs>
    <thirdIdsDialog ref="thirdIdsDialog"></thirdIdsDialog>
    <addCheckPhone ref="addCheckPhone"></addCheckPhone>
    <pickDialog ref="pickDialog"></pickDialog>
    <viewInfo ref="viewInfo"></viewInfo>

    <el-dialog title="备注" :visible.sync="showSinNumVisible">
      <span>{{ sinNumShow }}</span>
    </el-dialog>
    <!-- 改变状态的确认备注 -->
    <el-dialog :title="showDialogTitle" :visible.sync="dialogFormVisible">
      <el-form :model="unsoldFrom">
        <el-form-item :label="showDialogTitle == '下架原因' ? '下架原因' : '备注'" label-width="auto">
          <el-input v-model="unsoldFrom.note" autocomplete="off"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取 消</el-button>
        <el-button type="primary" @click="confirmSub">确 定</el-button>
      </div>
    </el-dialog>

    <monitorDetail ref="monitorDetail"></monitorDetail>
    <checkRecordsDialog ref="checkRecordsDialog"></checkRecordsDialog>

    <!--批量 导入弹出 -->
    <el-dialog title="批量导入" :visible.sync="showInportVisible" width="430px" append-to-body>
      <div v-loading="isUploading" element-loading-text="正在处理中，可能时间较长，请耐心等待...">
        <div v-if="zhuanshudaoru" style="margin-bottom: 15px">
          <div style="color: red; margin-bottom: 10px">
            提示：请先选择游戏，再点击下载模板，模板填写完成后上传。
          </div>
          <label for="">
            <b>选择游戏：</b>
            <el-select v-model="zhuanshudaoruGameName" placeholder="请选择游戏" clearable>
              <el-option v-for="(dict, i) in zhuanshuGames" :key="i" :label="dict" :value="dict" />
            </el-select>
          </label>
        </div>
        <el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="importheaders" :action="importUrl" :disabled="isUploading" :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag style="margin-bottom: 15px">
          <i class="el-icon-upload"></i>
          <div class="el-upload__text">
            将文件拖到此处，或
            <em>点击上传</em>
          </div>
          <div class="el-upload__tip text-center" slot="tip">
            <!-- <div class="el-upload__tip" slot="tip">
              <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据
            </div> -->
            <span>仅允许导入xls、xlsx格式文件。</span>
            <el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline" @click="downloadModel">下载模板</el-link>
          </div>
        </el-upload>
        <div slot="footer" class="dialog-footer">
          <el-button @click="showInportVisible = false">取 消</el-button>
          <el-button type="primary" @click="submitFileForm" :loading="isUploading">确 定</el-button>
        </div>
      </div>
    </el-dialog>
    <chongzhi ref="chongzhi"></chongzhi>
    <editPrice ref="editPrice"></editPrice>
    <!-- 自动截图  扫码授权 -->
    <el-dialog :visible="autoImgQrcodeShow" @close="autoImgQrcodeShow = false" append-to-body title="扫码授权" width="300px">
      <img :src="autoImgQrcode" alt="" />
    </el-dialog>

    <el-dialog :visible="showYanzhengma" title="自动截图验证码" width="500px" :close-on-click-modal="false" @close="Cancel">
      <div style="font-size: 16px;">
        <p>
          <span>游戏：</span><b style="color: #ffa2c0;">{{ yanzhengmaForm.gameName }}</b>
        </p>
        <p style="margin-top: 10px">
          <span>账号：</span><b style="color: #6c5dd3;">{{ yanzhengmaForm.accountNumber }}</b>
        </p>
        <h3 style="margin-top: 10px;">
          正在进行的截图任务,请输入你收到的验证码:
        </h3>
        <div style="margin-top: 15px">
          <el-input v-model="yanzhengmaForm.code" placeholder="请输入"></el-input>
        </div>
      </div>
      <div class="center" style="margin-top: 15px">
        <el-button @click="Cancel">关闭</el-button>
        <el-button type="primary" @click="submitYzm"> 提交 </el-button>
      </div>
    </el-dialog>

    <el-dialog title="选择上架方式" :visible.sync="showShangjiaLog" top="300px" width="500px">
      <span v-html="shangjiatishi">
      </span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="showShangjiaLog=false">取消</el-button>
        <el-button @click="jinshangjia">仅上架</el-button>
        <el-button type="primary" @click="shuaxinbingshangjia">上架并刷新</el-button>
      </span>
    </el-dialog>
    <caozuojilu ref="caozuojilu"></caozuojilu>
    <imageDialog ref="imageDialog"></imageDialog>
    <addBeforeDialog ref="addBeforeDialog"></addBeforeDialog>
    <!-- 选号网 -->
    <el-dialog title="我的选号网" :visible.sync="qrCodeShow" width="620px">
      <div ref="qrcode" style="width:300px; height:300px;margin:0 auto;margin-bottom:15px"></div>
      <div class="link-box">
        <div class="" style="text-align: center;">
          <span class="mylink"> <a :href="phoneLink" target="_blank">{{phoneLink}}</a></span>
          <el-button size="mini" @click="copy(phoneLink)">复制</el-button>
        </div>
      </div>
    </el-dialog>
    <huanbangjilu ref="huanbangjilu"></huanbangjilu>

    <editTableHeader ref="editTableHeader" @save="headerSave"></editTableHeader>
    <!-- 回收单详情弹窗 -->
    <backOrderDetailDialog ref="backOrderDetailDialog"></backOrderDetailDialog>
    <!-- 创建回收单 -->
    <createBackOrderCustom @addSuccess="getList" ref="createBackOrderCustom"></createBackOrderCustom>

    <!-- 冷却设置弹窗 -->
    <lengQueSet ref="lengQueSet"></lengQueSet>
    <!-- 高级操作弹出 -->
    <teshuDialog ref="teshuDialog" @close="getList"></teshuDialog>
    <!-- 商品详情查看 -->
    <goodsInfoDetail ref="goodsInfoDetail"></goodsInfoDetail>
  </div>
</template>

<script>
import {
  getMorePrice,
  getOutIds,
  getSupPhoneNumber,
  auditInfo,
  autoImgTasksendCode,
} from "@/api/info/info";
import { allList } from "@/api/partner/partner";
import checkRecordsDialog from "./checkRecordDialog.vue";
// import h5Dialog from "../saleList/h5Dialog.vue";
import addDialog from "./addAndEdit.vue";
import showLogs from "./showLogs";
import thirdIdsDialog from "./thirdIdsDialog";
import onSelfDialog from "./onSelfDialog.vue";
import deleteDialog from "./allDelete.vue";
import pushDialog from "./push.vue";
import moreSearch from "./moreSearch.vue";
import addCheckPhone from "./addCheckPhonePx.vue"; //加入破晓账号监控
import goodsListApi from "../../../api/gameConfig/goodsList";
import gameDictionaryApi from "../../../api/gameConfig/gameDictionary";
import gameListApi from "@/api/gameConfig/gameList";
import pickDialog from "../saleOrder/components/pickDialog";
import monitorDetail from "./monitorDetail";
import VirtualSelect from "@/components/VirtualSelect.vue";
import viewInfo from "./viewGoodsInfo.vue";
import { getDicts } from "@/api/system/dict/data";
import supplyConfigApi from "@/api/system/supplyConfig";
import selectTenant from "@/components/selectTenant/index.vue";
import { getToken } from "@/utils/auth";
import jingpaiApi from "@/api/jingpaishichang/index.js";
import chongzhi from "@/views/tenantPages/moneys/components/chongzhijifen.vue";
import editPrice from "./editPrice.vue";
import CryptoJS from "crypto-js";
import caozuojilu from "./caozuojilu.vue";
import huanbangjilu from "./huanbangjilu.vue";

import imageDialog from "./imageDialog.vue";

import addBeforeDialog from "./addBeforeDialog.vue";
import QRCode from "qrcodejs2";

import { goodsListHeaders } from "../../../utils/tableHeaders";
import editTableHeader from "../../../components/common/editTableHeader.vue";

import { getUserListHeaderByType } from "../../../api/tableHeader";
import backOrderDetailDialog from "../recycleManage/components/orderDetailDialog.vue";
import createBackOrderCustom from "../recycleManage/recycleOrders/createOrderCustom.vue";
import { getTenantPushSettingsByTenantId } from "@/api/system/shopManage";
import lengQueSet from "../tools/phoneManage/components/lengQueSet.vue";
import teshuDialog from "./teshuDialog.vue";
// 查看商品弹窗
import goodsInfoDetail from "./goodsInfoDetail.vue";

import { getUser } from "@/api/system/user";
import { listDept } from "@/api/system/dept";
export default {
  name: "GoodsManage",
  components: {
    addDialog,
    onSelfDialog,
    moreSearch,
    deleteDialog,
    pushDialog,
    showLogs,
    thirdIdsDialog,
    addCheckPhone,
    pickDialog,
    monitorDetail,
    VirtualSelect,
    viewInfo,
    selectTenant,
    checkRecordsDialog,
    chongzhi,
    editPrice,
    caozuojilu,
    imageDialog,
    addBeforeDialog,

    editTableHeader,
    huanbangjilu,
    backOrderDetailDialog,
    createBackOrderCustom,
    lengQueSet,
    teshuDialog,
    goodsInfoDetail,
  },
  data() {
    return {
      qrcode: null,
      qrCodeShow: false,
      phoneLink: "",
      shangjiatishi: "",
      shangjiaId: "",
      showShangjiaLog: false,
      showYanzhengma: false,
      yanzhengmaForm: {
        code: "",
      },

      autoImgQrcodeShow: false,
      autoImgQrcode: "",
      importheaders: {
        Authorization: "Bearer " + getToken(),
        timeout: 1000 * 60 * 10,
      },
      showInportVisible: false,
      outIdsData: [],
      supPhoneNum: "",
      allUsers: [], //所有用户列表
      gameList: [], //游戏列表
      columnList: [],
      tableData: {
        records: [],
        total: 0,
      },
      pageType: "",
      statusList: [
        {
          name: "全部",
          value: "",
        },
        {
          name: "在售商品",
          value: "1",
        },
        {
          name: "交易中",
          value: "2",
        },
        {
          name: "已售商品",
          value: "3",
        },
        {
          name: "下架商品",
          value: "4",
        },
        {
          name: "问题商品",
          value: "5",
        },
        {
          name: "损耗商品",
          value: "6",
        },
        {
          name: "审核拒绝",
          value: "98",
        },
      ],
      actived: "1",
      GameSelectedType: "", //筛选的游戏的类型
      sysList: [],
      carrierList: [], //运营商列表
      areaList: [], //大区列表
      serverList: [], //服务器列表
      selects: [], //表格的选中项
      ids: [], //表格选中的ids
      pushApiList: [],
      morePrice: [], //更多价格

      supplyList: [],
      levelArr: [],
      irreAttr: false, //隐藏无关字段
      showSinNumVisible: false, //查看备注
      sinNumShow: "",
      unsoldFrom: {
        note: null,
      },
      showDialogTitle: "",
      dialogFormVisible: false,
      tempData: null,
      loading: false,
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        saleState: "1",
        createIds: [],
        sort: "",
        sortColumn: "",
        dataType: "all",
        deptIdList: [],
      },
      regionalArr: [], //区服列表
      copyVlaue: "",
      customAttr: null,
      retailDomainList: [],
      xiaoshouguize: "",
      importUrl: process.env.VUE_APP_BASE_API + "/goods/info/importData",
      isUploading: false,
      cloneCost: "", //克隆商品需要的虞豆
      cloneTimes: "", //克隆次数
      zhuanshudaoru: false,
      zhuanshudaoruGameName: "王者荣耀", //专属导入选择的游戏
      zhuanshuGames: [
        "王者荣耀",
        "原神",
        // '枪战王者','地下城与勇士',
      ], //专属导入选择的游戏
      resAutoImg: "",
      refreshCost: "",
      lengQueObj: {},
      totalNumber: null,
      allDepts: [],
    };
  },
  async created() {
    if (this.$route.query.type) {
      this.pageType = this.$route.query.type;
    }

    await this.getTableHeader();

    if (this.$route.query.saleState) {
      this.actived = this.$route.query.saleState;
      this.queryParams.saleState = this.actived;
    }
    if (this.$route.query.unsoldDays) {
      this.queryParams.unsoldDays = this.$route.query.unsoldDays;
    }

    this.getList();
    this.getGameList();
    this.getPushList();
    // this.getDomain();
    this.getAllUserList();
    this.getLengQue();
    this.getDeptList();
  },
  // activated() {
  //   if (this.$route.query.saleState) {
  //     this.actived = this.$route.query.saleState;
  //     this.queryParams.saleState = this.actived;
  //     this.getList();
  //   }
  // },
  mounted() {},
  computed: {
    tenantList() {
      return this.$store.getters.tenantList;
    },
    shopInfo() {
      return this.$store.getters.shopInfo;
    },
    userInfo() {
      return this.$store.getters.userInfo;
    },
    hasPermiZhiding() {
      return this.checkPermi(["goods:list:zhiding"]);
    },
    hasPermiZiliao() {
      return this.checkPermi(["goods:list:viewZiliao"]);
    },
    // 计算剩余冷却时间
    getEndTime() {
      return (maxCreateTime, carrierType, carrierName) => {
        let key = carrierType;
        let result = "";
        if (carrierType == 1) {
          // 腾讯  区分QQ和微信
          if (carrierName && carrierName.toLowerCase().includes("qq")) {
            // QQ 大区
            key = "qq";
          } else {
            key = "wx";
          }
        }
        if (!this.lengQueObj[key]) {
          return "";
        }
        if (!maxCreateTime) {
          return "";
        }
        if (!carrierType) {
          return "";
        }
        if (!carrierName) {
          return "";
        }
        const now = new Date();
        const start = new Date(maxCreateTime);
        if (start) {
          const days = Number(this.lengQueObj[key]);
          if (days > 0) {
            // 计算时间差（毫秒）
            const timeDiff = now.getTime() - start.getTime();
            if (timeDiff > 0) {
              // 将毫秒转换为天数（1天 = 24 * 60 * 60 * 1000毫秒）
              const daysDiff = Math.floor(timeDiff / (1000 * 60 * 60 * 24));
              const shengyu = days - daysDiff;
              if (shengyu > 0) {
                result = `冷却剩余${shengyu}天`;
              }
              // if (shengyu > 0 && shengyu <= 1) {
              //   result = `即将结束冷却`;
              // }
            }
          }
        }
        return result;
      };
    },
    formatter() {
      return (val) => {
        let formatter = new Intl.NumberFormat("en-US");
        const formattedNumber = formatter.format(val);
        return formattedNumber;
      };
    },
  },
  methods: {
    // 查询部门列表
    async getDeptList() {
      try {
        if (this.checkPermi(["goods:list:deptSearch"])) {
          const { data } = await listDept();
          // console.log("%c Line:775 🌽 data", "color:#93c0a4", data);
          this.allDepts = data.filter((r) => r.parentId != 100);
        }
      } catch (error) {}
    },
    // 跳转客服系统
    goIM(IMid, chatType) {
      // let token = Cookies.get("Admin-Token");
      let obj = {
        type: "goChat",
        hxusername: IMid,
        chatType: chatType,
      };
      // 告诉IM系统，需要跳转聊天页
      this.$store.dispatch("postMsgToIM", obj);
    },
    //联系买家/卖家  查询用户信息
    async getOtherUserInfo(userId) {
      let { data } = await getUser(userId);
      //console.log("%c Line:200 🍞 data", "color:#2eafb0", data);
      this.goIM(data.hxusername, "singleChat");
    },

    // 查看商品详情页
    viewGoods(info) {
      this.$refs.goodsInfoDetail.open(info);
    },
    // 打开特殊操作的弹出
    openTeshu(row) {
      this.$refs.teshuDialog.open(row);
    },
    // 获取手机号冷却时间
    getLengQue() {
      getTenantPushSettingsByTenantId({
        tenantId: this.shopInfo.tenantId,
        type: 7, //7 商品换绑 冷却设置
      }).then((res) => {
        if (res.data && res.data.settingsJson) {
          this.lengQueObj = JSON.parse(res.data.settingsJson);
        }
      });
    },
    // 冷却时间设置
    openLengQue() {
      this.$refs.lengQueSet.open("goods");
    },

   async getTableHeader() {
    try {
      const res = await getUserListHeaderByType({ type: 1 })
      if (res.data && res.data.settingsJson) {
          this.columnList = JSON.parse(res.data.settingsJson);
        } else {
          this.columnList = [...goodsListHeaders];
        }
        const Obj = this.arrayToObject(this.columnList, "key");
        // Obj.saleState.isShow = false;
        if (Obj.isTop.isShow) Obj.isTop.isShow = this.hasPermiZhiding;
        if (Obj.ziliao.isShow) Obj.ziliao.isShow = this.hasPermiZiliao;
        if (this.pageType) {
          if (this.pageType == "check") {
            this.statusList = [
              {
                name: "待审核",
                value: "0",
              },
              {
                name: "审核拒绝",
                value: "98",
              },
            ];
            this.actived = "0";
            this.queryParams.saleState = this.actived;
            Obj.saleState.isShow = true;
          }
        }
    } catch (error) {
      
    }
   
    },
    // 打开回收订单详情
    openBackOrderDetail(id) {
      this.$refs.backOrderDetailDialog.open(id);
    },
    // 补录 自建回收单
    // 打开创建回收单弹窗
    openBackOrderAdd(goods) {
      this.$refs.createBackOrderCustom.open("byGoods", goods);
    },
    copy(txt) {
      this.$copyText(txt).then((res) => {
        this.$message.success("已复制到剪切板");
      });
    },
    // 打开表头设置
    headerSet() {
      this.$refs.editTableHeader.open(1);
    },
    // headerSave
    headerSave(listJson) {
      this.columnList = [];
      this.$nextTick(() => {
        this.columnList = JSON.parse(listJson);
        if (this.$refs.tableRef) {
          console.log(
            "%c Line:675 🍊 this.$refs.tableRef",
            "color:#93c0a4",
            this.$refs.tableRef
          );
          this.$refs.tableRef.doLayout();
        }
      });
      // this.getTableHeader();
    },
    // 生成二维码 选号网
    openQRCode() {
      this.qrCodeShow = true;

      let host = this.shopInfo.domain;
      if (host.includes(",")) {
        host = host.split(",")[0];
      }
      let hostt = `http://${host}/?user=${this.userInfo.userId}`;
      this.phoneLink = hostt;
      this.$nextTick(() => {
        if (this.qrcode != null) {
          this.qrcode.clear(); // 清除代码
        } else {
          this.qrcode = new QRCode(this.$refs.qrcode, {
            width: 300,
            height: 300,
            correctLevel: QRCode.CorrectLevel.L,
          });
          //生成二维码
          this.qrcode.makeCode(this.phoneLink);
        }
      });
    },
    // 更多操作
    moreFn(e, row) {
      if (e == 1) {
        // 编辑
        this.handleUpdate(row);
      } else if (e == 2) {
        // 上架
        this.upSale(row.id);
      } else if (e == 3) {
        // 到问题
        this.transQues(row.id);
      } else if (e == 4) {
        // 删除
        this.handleDelete(row);
      } else if (e == 5) {
        // 到损耗
        this.transZhaohui(row.id);
      } else if (e == 6) {
        // 审核
        this.checkAccountFn(row);
      } else if (e == 7) {
        // 克隆
        this.clone(row);
      } else if (e == 8) {
        // 日志
        this.showLogs(row.id);
      } else if (e == 9) {
        // 三方id
        this.showThirdId(row);
      } else if (e == 10) {
        // 加入监控
        this.addCheck(row);
      } else if (e == 11) {
        // 加入黑名单
        this.addBlack(row.id);
      } else if (e == 12) {
        // 发布到竞拍
        this.addJingpai(row.id);
      } else if (e == 13) {
        // 刷新
        this.shuaxinshangpin(row.id);
      } else if (e == 14) {
        // 操作日志
        this.openCaozuojilu(row.id);
      } else if (e == 15) {
        // 查看其他图片
        this.copyImgs(row.otherImg, "view");
      } else if (e == 16) {
        // 复制其他图片
        this.copyImgs(row.otherImg, "copy");
      } else if (e == 17) {
        // 换绑记录
        this.$refs.huanbangjilu.open(row.id);
      }
    },
    // 复制图片
    async copyImgs(otherImg, type) {
      if (otherImg) {
        const imgArr = JSON.parse(otherImg);
        if (imgArr && imgArr.length) {
          try {
            const urls = imgArr.map((item) => item.url);
            if (type == "view") {
              this.$refs.imageDialog.open(urls);
            } else if ("copy") {
              this.copyAsMergedImage(urls);
            }
          } catch (error) {
            console.error("Error copying images to clipboard:", error);
          }
        } else {
          this.$message.error("该商品暂无其他图片！");
        }
      }
    },

    // // 加载图片
    // getURLBase64(url) {
    //   return new Promise((resolve, reject) => {
    //     var xhr = new XMLHttpRequest();
    //     xhr.open("get", url, true);
    //     xhr.responseType = "blob";
    //     xhr.onload = function () {
    //       if (this.status === 200) {
    //         var blob = this.response;
    //         resolve(blob);
    //         // var fileReader = new FileReader();
    //         // fileReader.onloadend = function (e) {
    //         //   var result = e.target.result;
    //         //   resolve(result);
    //         // };
    //         // fileReader.readAsDataURL(blob);
    //       }
    //     };
    //     xhr.onerror = function (err) {
    //       reject(err);
    //     };
    //     xhr.send();
    //   });
    // },
    // 复制其他图片
    async copyAsMergedImage(urls) {
      this.loading = true;
      try {
        // 1. 合并图片到 Canvas
        const canvas = document.createElement("canvas");
        const images = await Promise.all(
          urls.map(
            (url) =>
              new Promise((resolve) => {
                const img = new Image();
                img.crossOrigin = "anonymous";
                img.src = url;
                img.onload = () => resolve(img);
              })
          )
        );
        canvas.width = Math.max(...images.map((img) => img.width));
        canvas.height = images.reduce(
          (sum, img) => sum + (canvas.width / img.width) * img.height,
          0
        );
        const ctx = canvas.getContext("2d");
        let yPos = 0;
        images.forEach((img) => {
          ctx.drawImage(
            img,
            0,
            yPos,
            canvas.width,
            (canvas.width / img.width) * img.height
          );
          yPos += (canvas.width / img.width) * img.height;
        });

        // 2. 转换为 Blob 写入剪贴板
        canvas.toBlob(async (blob) => {
          await navigator.clipboard.write([
            new ClipboardItem({ [blob.type]: blob }),
          ]);
          this.loading = false;
          this.$message.success("合并图片复制成功");
        }, "image/png");
      } catch (error) {
        this.loading = false;
      }
    },
    // 复制图文
    // copyInfo(sets){
    //     let imgDiv = document.createElement('div')
    //     imgDiv.id = '__imgDiv';
    //     imgDiv.setAttribute('style','z-index: -1;position: fixed;')
    //     let child = '';
    //     if(sets.txts){
    //         if(typeof sets.txts === 'string'){
    //             child += `<span>${sets.txts}</span>`
    //         }else{
    //             sets.txts.forEach(item=>{
    //                 child += `<span>${item}</span>`
    //             });
    //         }
    //     }
    //     if(sets.imgs){
    //         if(typeof sets.imgs === 'string'){
    //             sets.imgs = sets.imgs.indexOf('https')>-1?sets.imgs.replace('https','http'):sets.imgs;
    //             child += `<img src="${sets.imgs}" />`
    //         }else{
    //             sets.imgs.forEach(item=>{
    //                 const url = item.url;
    //                 child += `<img src="${url}" />`
    //             });
    //         }
    //     }
    //     imgDiv.innerHTML = child;
    //     document.body.insertBefore(imgDiv,document.body.lastChild)

    //     this.$nextTick(()=>{
    //       let dom = document.getElementById('__imgDiv')
    //       console.log(dom)
    //       const clipboard = new ClipboardJS('#__imgDiv', {
    //       text: trigger => {
    //         // const codeStr = this.generateCode()
    //         // this.$notify({
    //         //   title: '成功',
    //         //   message: '代码已复制到剪切板，可粘贴。',
    //         //   type: 'success'
    //         // })
    //         // return codeStr
    //       }
    //     })
    //     clipboard.on('error', e => {
    //       this.$message.error('代码复制失败')
    //     })

    //       // if (window.getSelection) {//chrome等主流浏览器
    //       //     let selection = window.getSelection();
    //       //     let range = document.createRange();
    //       //     range.selectNodeContents(dom);
    //       //     selection.removeAllRanges();
    //       //     selection.addRange(range);
    //       // } else if (document.body.createTextRange) {//ie
    //       //     let range = document.body.createTextRange();
    //       //     range.moveToElementText(dom);
    //       //     range.select();
    //       // }
    //       // document.execCommand('copy');
    //       // window.getSelection().removeAllRanges();
    //       imgDiv.parentNode.removeChild(imgDiv);
    //     })
    // },

    // 打开操作日志
    openCaozuojilu(id) {
      this.$refs.caozuojilu.open(id);
    },

    // 打开验证码提交框
    openYanzhengma(id, accountNumber, gameName) {
      this.yanzhengmaForm = {
        accountNumber: accountNumber,
        id: id,
        gameName: gameName,
      };
      this.showYanzhengma = true;
    },
    // 关闭验证码弹窗
    Cancel() {
      this.showYanzhengma = false;
      this.yanzhengmaForm = {
        code: "",
      };
    },
    submitYzm() {
      if (!this.yanzhengmaForm.code) {
        return this.$message({
          type: "error",
          message: "请输入验证码！",
        });
      }
      autoImgTasksendCode(this.yanzhengmaForm).then((res) => {
        if (res.code == 200) {
          this.Cancel();
          this.$message({
            type: "success",
            message: res.msg,
          });
        } else {
          this.$message({
            type: "error",
            message: res.msg,
          });
        }
      });
    },

    // 自动截图相关
    // 扫码
    openQrcode(row) {
      goodsListApi
        .autoImgRecordsaoma({ id: row.autoImgRecordId })
        .then((res) => {
          console.log("%c Line:521 🌮 res", "color:#93c0a4", res);
          if (res.data && res.data.resLogin) {
            let loginInfo = JSON.parse(res.data.resLogin);
            console.log("%c Line:531 🍯 loginInfo", "color:#ed9ec7", loginInfo);
            if (loginInfo.login_img) {
              this.autoImgQrcodeShow = true;
              this.autoImgQrcode =
                "data:image/gif;base64," + loginInfo.login_img;
            } else {
              this.$message.error("二维码暂未生成，请稍后再试！");
            }
          } else {
            this.$message.error("二维码暂未生成，请稍后再试！");
          }
        });
    },
    // 查詢結果
    queryResult(row) {
      goodsListApi
        .autoImgRecordChaxunjieguo({ id: row.autoImgRecordId })
        .then((res) => {
          console.log("%c Line:549 🥑 res", "color:#465975", res);
          if (res.data && res.data.resAutoImg) {
            const resAutoImg = JSON.parse(res.data.resAutoImg);
            this.resAutoImg = resAutoImg;
            this.$alert(resAutoImg);
            console.log("%c Line:531 🍯 loginInfo", "color:#ed9ec7", loginInfo);
            // if (loginInfo.login_img) {
            //   this.autoImgQrcodeShow = true
            //   this.autoImgQrcode  ="data:image/gif;base64,"+ loginInfo.login_img
            // }else{
            //   this.$message.error('请稍后再试！')
            // }
          } else {
            this.$message.error("请稍后再试！");
          }
        });
    },
    addClose(e) {
      if (e) {
        this.goLinkName(e);
      }
    },
    // 跳转页面  用组件名
    goLinkName(name, permiStr) {
      if (permiStr && !this.checkPermi([permiStr])) {
        return this.$message.error(
          "你还没有该模块权限，请联系管理员分配权限！"
        );
      }
      this.$router.push({
        name: name,
      });
    },
    // 点击批量导入按钮
    piliangdaoru() {
      this.importUrl = process.env.VUE_APP_BASE_API + "/goods/info/importData";
      this.isUploading = false;
      this.zhuanshudaoru = false;
      this.showInportVisible = true;
    },
    // 点击专属批量导入按钮
    dakaipiliangdaoru() {
      // if (!this.queryParams.gameId) {
      //   return this.$alert("请先选择游戏！");
      // }
      this.zhuanshudaoru = true;
      this.importUrl =
        process.env.VUE_APP_BASE_API + "/goods/info/importTDData";
      this.isUploading = false;

      this.showInportVisible = true;
    },
    // 提交上传文件
    submitFileForm() {
      this.$refs.upload.submit();
    },
    // 文件上传中处理
    handleFileUploadProgress(event, file, fileList) {
      this.isUploading = true;
    },
    // 文件上传成功处理
    handleFileSuccess(response, file, fileList) {
      this.showInportVisible = false;
      this.isUploading = false;
      this.$refs.upload.clearFiles();
      this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
      this.getList();
    },
    // 导出模版
    downloadModel() {
      if (this.zhuanshudaoru) {
        if (this.zhuanshudaoruGameName) {
          this.isUploading = true;
          goodsListApi
            .downloadTDModel({
              gameName: this.zhuanshudaoruGameName,
            })
            .then((res) => {
              this.isUploading = false;
              // this.$download.name(res.msg);
              this.$download.downloadFile(
                res,
                this.zhuanshudaoruGameName + "导入模板"
              );
            })
            .catch((err) => {
              this.isUploading = false;
            });
        } else {
          return this.$message.error("请先选择游戏！");
        }
      } else {
        this.isUploading = true;
        goodsListApi
          .downloadModel()
          .then((res) => {
            this.isUploading = false;
            // this.$download.name(res.msg);
            this.$download.downloadFile(res, "商品导入模板");
          })
          .catch((err) => {
            this.isUploading = false;
          });
      }
    },
    // 查看账号监控记录
    openRecords(id) {
      this.$refs.checkRecordsDialog.open(id);
    },
    // 置顶改变
    isTopChange(e, row) {
      goodsListApi
        .topOnOrOff({
          id: row.id,
          isTop: e,
        })
        .then((res) => {
          this.$message.success(res.msg);
        })
        .catch((err) => {
          row.isTop = e == 1 ? 2 : 1;
        });
    },

    viewInfo(row) {
      this.$refs.viewInfo.open(row);
    },
    // 获取所有用户
    getAllUserList(val) {
      supplyConfigApi.getAllUserList({
        userNewType:1
      }).then((res) => {
        this.allUsers = res.rows;
      });
    },
    // 查看换绑详情
    openMoncheckDetail(id) {
      this.$refs.monitorDetail.open(id);
    },
    // 发布到竞拍市场
    addJingpai(id) {
      this.$confirm("确定将此商品发布到竞拍市场吗？", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
      })
        .then(({ value }) => {
          jingpaiApi
            .addGoodsForJingjia({
              id: id,
            })
            .then((res) => {
              if (res.code == 200) {
                this.$message.success("已发布到竞拍市场！");
              }
            });
        })
        .catch(() => {});
    },
    // 加入黑名单
    addBlack(id) {
      this.$confirm("确定将此游戏账号加入黑名单吗？", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
      })
        .then(({ value }) => {
          goodsListApi
            .addBlack({
              accountId: id,
            })
            .then((res) => {
              this.$message.success("加入黑名单成功！");
              this.getList();
            });
        })
        .catch(() => {});
    },
    // 改价
    priceedit(row) {
      this.$refs.editPrice.open(row);
    },
    //  获取克隆次数
    async getCopyCount() {
      const res = await goodsListApi.getCopyCount();
      this.cloneTimes = res.data;
    },
    //  获取克隆虞豆
    async getCloneYudou() {
      return new Promise((resolve, reject) => {
        this.getDicts("points").then((res) => {
          if (res.data && res.data.length) {
            const obj = this.arrayToObject(res.data, "dictLabel");
            this.cloneCost = Math.abs(obj["copyCost"].dictValue);
          }
          resolve();
        });
      });
    },
    // 克隆账号
    async clone(row) {
      await this.getCopyCount();
      await this.getCloneYudou();
      this.$confirm(
        `克隆商品会将该商品删除后重新上架，并同步各api推送渠道；每次操作消耗 <span style="color:red">${this.cloneCost}</span> 虞豆，今日已用  <span style="color:red">${this.cloneTimes.yishiyong}/${this.cloneTimes.zongshu}</span>次，是否继续？`,
        "提示",
        {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "",
          dangerouslyUseHTMLString: true,
        }
      )
        .then(() => {
          this.loading = true;
          goodsListApi
            .goodsClone(row.id)
            .then((res) => {
              this.loading = false;
              if (res.code == 200) {
                this.$message({
                  type: "success",
                  message: "克隆成功!",
                });
                this.getList();
              } else {
                this.$message({
                  type: "error",
                  message: res.msg,
                });
              }
            })
            .catch((err) => {
              this.loading = false;
              if (err.code == 10000) {
                // 虞豆不足
                this.chongzhijifen();
              }
            });
        })
        .catch(() => {});
    },
    //  获取刷新商品一次需要的虞豆
    async getShuaxinYudou() {
      return new Promise((resolve, reject) => {
        this.getDicts("points").then((res) => {
          if (res.data && res.data.length) {
            const obj = this.arrayToObject(res.data, "dictLabel");
            this.refreshCost = Math.abs(obj["refreshCost"].dictValue);
          }
          resolve();
        });
      });
    },
    goLinkto() {
    this.$router.push({
      path: "/jifenshangcheng",
    });
    },
    // 刷新商品排序
    async shuaxinshangpin(id) {
      await this.getShuaxinYudou();
      let baseServer =  this.shopInfo&&this.shopInfo.baseServer || ''
      let cont
      let tips =''
      let resdata 
      if(baseServer ==2) {
        cont = `<span style="color:#999;text-decoration: line-through;">${
            this.refreshCost || 0
          }</span>`
          resdata = `您已开通[基础服务包]，本次操作免费 `
      }else {
        cont = `<span style="color:red">${
          this.refreshCost || 0
        }</span> `
        tips = `<span>开通 <a style='color:#6c5dd3' @click='goLinkto'>基础服务包</a>后免虞豆</span>`
         resdata = `刷新商品会提升该商品的排名，不同步三方渠道；<br/>每次操作消耗 ${cont} 虞豆，是否继续？<br/>${tips} `
      }
      
      this.$confirm(
        `${resdata}`,
        "提示",
        {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "",
          dangerouslyUseHTMLString: true,
        }
      )
        .then(() => {
          this.loading = true;
          goodsListApi
            .goodsRefreshTime({ id: id })
            .then((res) => {
              this.loading = false;
              if (res.code == 200) {
                this.$message({
                  type: "success",
                  message: "刷新成功!",
                });
                this.getList();
              } else {
                this.$message({
                  type: "error",
                  message: res.msg,
                });
              }
            })
            .catch((err) => {
              this.loading = false;
              if (err.code == 10000) {
                // 虞豆不足
                this.chongzhijifen();
              }
            });
        })
        .catch(() => {});

        // 弹窗打开后绑定事件
this.$nextTick(() => {
  const el = document.querySelector('.el-message-box__message a');
  if (el) {
    el.onclick = () => {
      this.goLinkto(); // 这里的 this 是 Vue 实例
      if (this.$msgbox && typeof this.$msgbox.close === 'function') {
        this.$msgbox.close();
      } else if (this.$messageBox && typeof this.$messageBox.close === 'function') {
        this.$messageBox.close();
      }
    };
  }
});
    },
    // 打开充值弹窗
    chongzhijifen() {
      this.$refs.chongzhi.open();
      // this.$refs.paySuccess.open();
    },
    openUrl(url) {
      window.open(url);
    },
    // 供货手机号
    getSupPhone(row) {
      this.supPhoneNum = "";
      getSupPhoneNumber({ userId: row.createId }).then((res) => {
        this.supPhoneNum = res.msg;
      });
    },
    // 更多价格
    getMore(row) {
      ////console.log("%c Line:1303 🍐 row", "color:#33a5ff", row);
      getMorePrice({ infoid: row.id }).then((res) => {
        ////console.log("%c Line:1304 🥚 res", "color:#7f2b82", res);
        this.morePrice = res.data;
      });
    },
    // 查询账号的三方ID
    getoutId(row) {
      getOutIds(row.id).then((res) => {
        ////console.log("%c Line:490 🍪 res", "color:#f5ce50", res);
        this.outIdsData = res.data;
      });
    },
    // // 获取分销站域名
    // getDomain() {
    //   getDicts("retailDomain").then((res) => {
    //     if (res.code == 200) {
    //       this.retailDomainList = res.data;
    //     }
    //   });
    // },

    // 游戏列表
    getGameList() {
      gameListApi.getGameList().then((res) => {
        this.gameList = res.rows;
      });
    },
    // 获取列表
    getList() {
      this.tableData.records = [];
      this.loading = true;
      // if (this.pageType == "pool") {
      //   // getGoodsListPool 账号池
      //   goodsListApi
      //     .getGoodsListPool(this.queryParams)
      //     .then((response) => {
      //       this.$nextTick(() => {
      //         this.loading = false;
      //         this.tableData.records = JSON.parse(
      //           JSON.stringify(response.rows)
      //         );
      //         this.tableData.total = response.total;
      //       });
      //     })
      //     .catch((err) => {
      //       this.loading = false;
      //     });
      // }
      // // else if (this.pageType == 'myAccount') {
      // //   // 我的账号
      // //   goodsListApi.myAccount(this.queryParams)
      // //     .then(response => {
      // //       this.$nextTick(() => {
      // //         this.loading = false;
      // //         this.tableData.records = JSON.parse(JSON.stringify(response.rows));
      // //         this.tableData.total = response.total;
      // //       });
      // //     })
      // //     .catch(err => {
      // //       this.loading = false;
      // //     });
      // // }
      // else {
        
      // }
      // if (this.pageType == "check") {
      //     this.queryParams.saleState = 0;
      //   }
        this.totalNumber = null;
        goodsListApi
          .getGoodsAllList(this.queryParams)
          .then((response) => {
            this.$nextTick(() => {
              this.loading = false;
              this.tableData.records = JSON.parse(
                JSON.stringify(response.rows)
              );
              this.tableData.total = response.total;
              if (response.params) {
                this.totalNumber = response.params;
              }
            });
          })
          .catch((err) => {
            this.loading = false;
          });
    },
    // //获取供货商接口
    // getUserList() {
    //   getSupplyList("supplyCustomer").then(res => {
    //     if (res.code == 200) {
    //       this.supplyList = res.data;
    //     }
    //   });
    // },
    // 获取推送接口列表
    getPushList() {
      allList({ status: 1 }).then((res) => {
        this.pushApiList = res.rows;
      });
    },
    Ke(e, t, a) {
      const u = CryptoJS;
      let s = u.enc.Utf8.parse(t);
      let l = u.enc.Utf8.parse(a);
      const i = u.enc.Utf8.parse(e);
      const o = u.AES.encrypt(i, s, {
        iv: l,
        mode: u.mode.CBC,
        padding: u.pad.Pkcs7,
      });
      return u.enc.Base64.stringify(o.ciphertext);
    },
    // 打开更多搜索弹窗
    openMoreSearch() {
      // let e='ff123123',t="DzLALeVwKbgtcOitGPpiVLm94J0pdghb",a="DzLALeVwKbgtcOit"
      // const str = this.Ke(e,t,a)
      // console.log("%c Line:1011 🍡 str", "color:#3f7cff", str);
      // return
      if (!this.queryParams.gameId) {
        return this.$alert("请先选择游戏名称！");
      }
      this.$refs.moreSearch.open(this.queryParams.gameId);
    },
    // 更多搜索确认
    sureSearch(form) {
      this.queryParams = { ...this.queryParams, ...form };
      this.search();
    },
    // 搜索
    search() {
      if (this.queryParams.outid && this.queryParams.outid.length < 4) {
        return this.$message.error("三方ID不能少于4位！");
      }
      this.queryParams.pageNum = 1;
      this.queryParams.pageSize = 10;
      this.getList();
    },
    // 隐藏无关属性
    onOfOff() {
      const list = JSON.parse(JSON.stringify(this.tableData.records));
      this.tableData.records = [];
      this.loading = true;
      setTimeout(() => {
        this.$nextTick(() => {
          this.tableData.records = JSON.parse(JSON.stringify(list));
          this.loading = false;
        });
      }, 300);
    },
    // 表格排序
    sortFun(val) {
      this.queryParams.sort = val.order;
      this.queryParams.sortColumn = val.prop;
      this.getList();
    },
    // tabs切换时触发
    tabChange(e) {
      let active = e;
      console.log("%c Line:1679 🥥 active", "color:#ea7e5c", active);
      if (!active) {
        active = "";
      }
      this.queryParams.saleState = active;
      this.queryParams.sort = "";
      this.queryParams.sortColumn = "";

      if (this.queryParams.saleState == 3) {
        // 已售
        this.queryParams.sort = "descending";
        this.queryParams.sortColumn = "saletime";
      }
      if (this.queryParams.saleState == 4) {
        // 下架
        this.queryParams.sort = "descending";
        this.queryParams.sortColumn = "changeTime";
      }
      this.getList();
    },
    // 新增
    addACount() {
      this.$refs.addDialog.open("add");
      // this.$refs.addBeforeDialog.open("add");
    },
    // 查看三方ID
    showThirdId(row) {
      this.$refs.thirdIdsDialog.open(row);
    },
    showLogs(id) {
      this.$refs.showLogs.open(id, null, null);
    },
    // 转自售
    openOnSelf(row) {
      this.$refs.onSelfDialog.open(row);
    },
    // 表格选择项改变
    handleSelection(arr) {
      ////console.log("%c Line:442 🍆 表格选择改变", "color:#f5ce50", arr);
      this.selects = arr;
      this.ids = [];
      if (arr.length == 0) {
        this.ids = [];
      } else {
        arr.forEach((t) => {
          this.ids.push(t.id);
        });
      }
    },
    // 审核账号
    checkAccountFn(row) {
      let ids = '';
      if (row) {
        // ids = row.id;
        // 单个审核 直接进入编辑弹窗
        this.handleUpdate(row,'shenhe')
      } else {
      // 批量审核  校验选中项有无代售
        if (this.ids && this.ids.length > 0) {
          let allSelf = true
          this.selects.forEach(r=>{
            if(r.ifself!=1){
              allSelf = false
            }
          })
          if(!allSelf){
            // 含有代售商品
            return this.$alert("批量审核不能选择代售商品！");
          }
          ids = this.ids.join(",");
        } else {
          this.$alert("请先选择账号！");
          return;
        }
      }
      if (ids) {
        this.$modal
          .confirm("确认审核通过吗？")
          .then(() => {
            this.loading = true;
            goodsListApi.auditGoods(ids).then((res) => {
              this.loading = false;
              this.$alert(res.msg);
              this.getList();
            });
          })
          .catch(() => {});
      }
    },
    // 打开全部删除弹窗
    deleteAll() {
      this.$refs.deleteDialog.open();
    },
    // 批量下架
    piliangXiajia() {
      const ids = this.ids.join(",");
      if (!ids) {
        return this.$alert("请先选择数据！");
      }
      let that = this;
      this.$modal
        .confirm('是否确认下架编号为"' + ids + '"的数据项？')
        .then(function () {
          that.loading = true;
          goodsListApi
            .batchDown(ids)
            .then((res) => {
              that.loading = false;
              that.getList();
              that.$modal.msgSuccess(res.msg);
            })
            .catch((err) => {
              that.$modal.msgSuccess(err.msg);
            });
        })
        .catch(() => {});
    },
    // 批量复制
    copyBatch() {
      if (this.selects.length) {
        let str = "";

        this.selects.forEach((item) => {
          // let hostt = `${this.retailDomainList[0].dictValue}/#/pages/detail/index?id=${item.id}`
          // \n图片：${hostt}
          str = `${str}商品ID：${item.id}\n自编号：${item.thirdId}\n区服：${
            item.systemName ? item.systemName + "/" : ""
          }${item.carrierName ? item.carrierName + "/" : ""}${item.groupName}${
            item.serverName
          }\n简介：${item.des}\n ===================== \n`;
        });
        this.$copyText(str).then(
          (e) => {
            this.$message({
              type: "success",
              message: "已复制到剪切板！",
            });
          },
          function (e) {}
        );
      } else {
        return this.$alert("请先选择数据！");
      }
    },
    // 删除
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids.join(",");
      if (!ids) {
        return this.$alert("请先选择数据！");
      }
      let that = this;
      this.$modal
        .confirm('是否确认删除游戏账号编号为"' + ids + '"的数据项？')
        .then(function () {
          that.loading = true;
          goodsListApi
            .delGoods(ids)
            .then((res) => {
              that.$modal.msgSuccess(res.msg);
              that.getList();
            })
            .catch((err) => {
              that.loading = false;
              that.getList();
            });
        })
        .catch(() => {});
    },
    // 批量推送
    // 推送
    pushBatch(item) {
      if (this.ids.length > 1) {
        this.$modal.msgError("只能选择一条数据");
        return true;
      } else if (this.ids.length == 0) {
        this.$modal.msgError("请先选择一条数据");
        return true;
      }
      this.$refs.pushDialog.open({
        id: this.ids[0],
        configId: item,
      });
    },
    // 销售端客服提号
    addOrder(row) {
      this.$refs.pickDialog.open(row, "kefu");
    },

    // 下架商品
    downSale(id) {
      this.$prompt("下架原因", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        inputPattern: /\S/,
        inputErrorMessage: "请填写下架原因",
      })
        .then(({ value }) => {
          this.$modal
            .confirm("是否确认下架编号为" + id + '"的游戏账号？')
            .then(() => {
              goodsListApi
                .downGoods({
                  downDes: value,
                  id: id,
                })
                .then((res) => {
                  this.$modal.msgSuccess(res.msg);
                  this.getList();
                });
            });
        })
        .catch(() => {});
    },
    // 上架商品
    async upSale(id) {
      await this.getShuaxinYudou();
      this.shangjiatishi = `刷新商品会提升该商品的排名，不同步三方渠道；每次操作消耗 <span style="color:red">${
        this.refreshCost || 0
      }</span> 虞豆,仅上架不消耗虞豆。`;
      this.shangjiaId = id;
      this.showShangjiaLog = true;
      // this.$confirm(
      //   `如果刷新并上架，刷新商品会提升该商品的排名，不同步三方渠道；每次操作消耗 <span style="color:red">${this.refreshCost||0}</span> 虞豆`,
      //   "请选择上架方式",
      //   {
      //     confirmButtonText: "刷新并上架",
      //     cancelButtonText: "仅上架",
      //     type: "",
      //     hideIcon:true,
      //     dangerouslyUseHTMLString: true,
      //   }
      // )
      //   .then(() => {

      //   })
      //   .catch((err) => {
      //     console.log("%c Line:1591 🎂 err", "color:#f5ce50", err);
      //     // goodsListApi.upGoods(id).then((res) => {
      //     //   this.$modal.msgSuccess(res.msg);
      //     //   this.getList();
      //     // })
      //   });
    },
    // 刷新并上架
    shuaxinbingshangjia() {
      if (!this.shangjiaId) {
        return;
      }
      this.loading = true;
      goodsListApi.upGoods(this.shangjiaId).then((res) => {
        this.$modal.msgSuccess(res.msg);
        goodsListApi
          .goodsRefreshTime({ id: this.shangjiaId })
          .then((res) => {
            this.loading = false;
            this.showShangjiaLog = false;
            if (res.code == 200) {
              this.$message({
                type: "success",
                message: "刷新成功!",
              });
              this.getList();
            } else {
              this.$message({
                type: "error",
                message: res.msg,
              });
            }
          })
          .catch((err) => {
            this.showShangjiaLog = false;
            this.loading = false;
            if (err.code == 10000) {
              // 虞豆不足
              this.chongzhijifen();
            }
          });
      });
    },
    jinshangjia() {
      if (!this.shangjiaId) {
        return;
      }
      this.loading = true;
      goodsListApi.upGoods(this.shangjiaId).then((res) => {
        this.$modal.msgSuccess(res.msg);
        this.loading = false;
        this.getList();
        this.showShangjiaLog = false;
      });
    },

    // 转为问题号
    transQues(id) {
      this.$prompt("问题描述", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        inputPattern: /\S/,
        inputErrorMessage: "请填写问题描述",
      })
        .then(({ value }) => {
          this.$modal
            .confirm("是否确认编号为" + id + '"的游戏账号转为问题账号？')
            .then(() => {
              goodsListApi
                .problemGoods({
                  problemDes: value,
                  id: id,
                })
                .then((res) => {
                  this.$modal.msgSuccess(res.msg);
                  this.getList();
                });
            });
        })
        .catch(() => {});
    },
    // 转为找回
    transZhaohui(id) {
      this.$prompt("找回备注", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        inputPattern: /\S/,
        inputErrorMessage: "请填写找回备注",
      })
        .then(({ value }) => {
          this.$modal
            .confirm("是否确认编号为" + id + '"的游戏账号转为找回账号？')
            .then(() => {
              goodsListApi
                .retrieveGoods({
                  retrieveDes: value,
                  id: id,
                })
                .then((res) => {
                  this.$modal.msgSuccess(res.msg);
                  this.getList();
                });
            });
        })
        .catch(() => {});
    },
    // 改变状态
    handleAudit(type, operation, id, flag) {
      const ids = id;
      let params = {};
      params.type = type;
      params.operation = operation;

      // 转为问题号需要备注
      if (type == 4 && !flag) {
        this.showDialogTitle = "转为问题号";
        this.tempData = params;
        this.tempData.ids = ids;
        this.dialogFormVisible = true;
        return;
      }
      // 下架需要填写原因
      if (type == 7 && !flag) {
        this.showDialogTitle = "下架原因";
        this.tempData = params;
        this.tempData.ids = ids;
        this.dialogFormVisible = true;
        return;
      }
      if (type == 4) {
        params.note = this.unsoldFrom.note;
      }
      if (type == 7) {
        params.offres = this.unsoldFrom.note;
      }
      this.$modal
        .confirm(
          "是否确认" + operation + '游戏账号编号为"' + ids + '"的数据项？'
        )
        .then(function () {
          return auditInfo(ids, params);
        })
        .then(() => {
          this.getList();
          this.$modal.msgSuccess(operation + "成功");
        })
        .catch(() => {});
    },
    // // 上架
    // upAccountCommit(id) {
    //   this.$modal
    //     .confirm("是否确认上架" + id + '"？')
    //     .then(function () {
    //       return upAccount(id);
    //     })
    //     .then(() => {
    //       this.getList();
    //       this.$modal.msgSuccess("上架成功");
    //     })
    //     .catch(() => { });
    // },
    // 转为问题号，下架
    confirmSub(flag) {
      this.dialogFormVisible = false;
      this.handleAudit(
        this.tempData.type,
        this.tempData.operation,
        this.tempData.ids,
        true
      );
    },

    // // 双击行查看详情图片
    // showImage(row) {
    //   let hostt = `${this.retailDomainList[0].dictValue}/#/pages/detail/index?id=${row.id}`;
    //   this.$refs.h5Dialog.open(hostt);
    // },
    // 双击编辑信息
    handleUpdate(row,type) {
     if (
        row.saleState != 1 &&
        row.saleState != 0 &&
        row.saleState != 4&&
        row.saleState != 98
      ) {
        this.$refs.addDialog.open("view", row.id);
      } else {
        this.$refs.addDialog.open("edit", row.id);
      }
    },
    // 查看备注
    showSinNum(row) {
      this.sinNumShow = row.sinNum;
      this.showSinNumVisible = true;
    },
    // 店铺改变
    tenantChange(e) {
      this.queryParams.tenantId = e;
    },
    // 选择游戏
    selectGameType(val) {
      if (!val) {
        val = null;
        this.sysList = [];
        this.carrierList = [];
        this.areaList = [];
        this.GameSelectedType = '';
        this.queryParams.gameId = '';
        this.queryParams.gameName = '';
        return;
      }
      let dataType = this.queryParams.dataType;
      this.queryParams = {
        pageNum: 1,
        pageSize: 10,
        saleState: this.queryParams.saleState,
        // operType: "supply",
        sort: "",
        sortColumn: "",
        dataType: dataType,
        tenantId:this.queryParams.tenantId||null
      };
      // this.queryParams.saleState = this.actived != 0 ? this.actived : "";

      this.gameList.forEach((r) => {
        if (r.id == val) {
          this.GameSelectedType = r.type;
          this.queryParams.gameId = val;
          this.queryParams.gameName = r.name;
        }
      });
      if (this.GameSelectedType === 0) {
        // 手游
        // 获取系统列表和运营商列表
        this.getSysList();
        this.getYysList();
      } else {
        // 端游
        // 获取大区列表
        this.getAreaList2();
      }

      // this.search();
    },
    // 获取系统列表
    getSysList() {
      gameDictionaryApi
        .getChildList({
          gameId: this.queryParams.gameId,
          systemKey: "system",
        })
        .then((res) => {
          this.sysList = res.rows;
        });
    },
    // 获取运营商列表
    getYysList() {
      gameDictionaryApi
        .getChildList({
          gameId: this.queryParams.gameId,
          systemKey: "carrier",
        })
        .then((res) => {
          this.carrierList = res.rows;
        });
    },
    // 运营商改变  获取大区列表
    getAreaList(e) {
      // this.search();
      let obj = {
        gameId: this.queryParams.gameId,
        systemKey: "group",
      };
      this.queryParams.groupId = "";
      this.queryParams.serverId = "";

      // 运营商改变 找出选择的运营商的对象
      if (e) {
        this.carrierList.forEach((i) => {
          if (i.id == e) {
            obj.systemKey = i.systemKey + "group";
          }
        });
      }
      gameDictionaryApi.getChildList(obj).then((res) => {
        this.areaList = res.rows;
      });
    },
    // 大区改变  获取服务器列表
    getServiceList(e) {
      // this.search();
      this.queryParams.serverId = "";

      if (e) {
        gameDictionaryApi
          .getList({
            parentId: e,
          })
          .then((res) => {
            this.serverList = res.rows;
          });
      } else {
        this.serverList = [];
      }
    },
    //端游 直接获取大区
    getAreaList2() {
      let obj = {
        gameId: this.queryParams.gameId,
        systemKey: "group",
      };
      gameDictionaryApi.getChildList(obj).then((res) => {
        this.areaList = res.rows;
      });
    },
    // 加入掉绑监控
    addCheck(row) {
      let reg = new RegExp(/^[1-9][0-9]{4,10}$/);
      let reg2 = new RegExp(/^(1[0-9][0-9])\d{8}$/);
      let tel = "";
      if (row.saleState == 1) {
        // 未售 加入掉绑  手机号取 securityPhone
        tel = row.securityPhone;
      } else if (row.saleState == 3) {
        // 未售 加入掉绑  手机号取 changeTel
        tel = row.changeTel;
      }
      if (reg.test(row.accountNumber)) {
      } else {
        this.$alert(`QQ号码不正确或商品账号不是QQ号，无法添加！`);
        return;
      }
      if (reg2.test(tel)) {
      } else {
        this.$alert(`手机号码不正确，无法添加！`);
        return;
      }
      row.tel = tel;
      this.$refs.addCheckPhone.open(row);
    },
    // 复制商品信息
    keyCopy(item) {
      // let hostt = `${this.retailDomainList[0].dictValue}/#/pages/detail/index?id=${item.id}`
      // \n图片：${hostt}
      this.copyVlaue = `商品ID：${item.id}\n自编号：${item.thirdId}\n区服：${
        item.systemName ? item.systemName + "/" : ""
      }${item.carrierName ? item.carrierName + "/" : ""}${item.groupName}${
        item.serverName
      }\n简介：${item.des}`;
    },
    // 复制成功和失败的方法
    onCopy(e) {
      this.$modal.msgSuccess("复制成功");
      this.copyVlaue = "";
    },
    onError() {
      this.$modal.msgError("复制失败");
      this.copyVlaue = "";
    },
    //重置
    resetQuery() {
      let dataType = this.queryParams.dataType;
      this.queryParams = {
        pageNum: 1,
        pageSize: 10,
        saleState: this.queryParams.saleState,
        // operType: "supply",
        sort: "",
        sortColumn: "",
        dataType: dataType,
      };
      // this.queryParams.saleState = this.actived != 0 ? this.actived : "";
      this.getList();
    },
    // getHost() {
    //   getDicts("apphost").then(res => {
    //     if (res.code == 200) {
    //       ////console.log(res);
    //       if (res.data.length > 0) {
    //         this.hoste = res.data[0].dictValue;
    //       }
    //     }
    //   });
    // },
    // 每页条数改变
    handleSizeChange(val) {
      this.queryParams.pageSize = val;
      this.getList();
    },
    // 页码改变
    handleCurrentChange(val) {
      this.queryParams.pageNum = val;
      this.getList();
    },
  },
};
</script>
<style lang="scss" scoped>
.app-container {
  padding: 0;
}
.zdy-des {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  margin: 6px 0;
}
.btn .el-button {
  margin-right: 5px;
}

#qrCode {
  display: inline-block;
  margin: 0 auto;
  /*水平居中*/
  position: relative;
  top: 15%;

  /* img: {
    width: 200px;
    height: 200px;
    background-color: #fff; //设置白色背景色
    padding: 6px; // 利用padding的特性，挤出白边
  } */
}

.search-form-new ::v-deep .el-input {
  width: 200px !important;
}

.sign {
  display: inline-block;
  width: 20px;
  height: 20px;
  background-color: #ffcc66;
  border-radius: 50%;
  font-size: 12px;
  line-height: 20px;
  text-align: center;
  color: #fff;
  margin-right: 5px;

  &.ping {
    background-color: #1890ff;
  }
}
.xsgz-btn {
  position: absolute;
  right: 250px;
  top: 7px;
  z-index: 99;
}
// .tuisongbtn ::v-deep .el-dropdown-menu {
//   max-height: 600px;
//   overflow-y: hidden;
// }
::v-deep .el-message-box__message {
  word-break: break-all;
}
::v-deep .search-form-new .el-input__inner {
  text-align: left;
}
</style>
<style>
.el-dropdown-menu {
  max-height: 600px;
  overflow-y: auto;
}
</style>
<style>
@font-face {
  font-family: "myFontruihei5";
  src: url("../../../assets/font/ruihei.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}
</style>
